#include <bits/stdc++.h>
// 2025/01/28
// tag: 
// Author: Zhang Muen
using namespace std;

int64_t l, r, ans, Euler[1000001], num[1000001];
bool is_prime[1000001];
vector<int> prime;

void EulerSieve(){
    for (int i = 2; i <= sqrt(r) + 1; i++){
        if (!is_prime[i])
            prime.push_back(i);
        for (int j = 0; j < prime.size() && i * prime[j] <= sqrt(r) + 1; j++){
            is_prime[i * prime[j]] = true;
            if (i % prime[j] == 0)
                break;
        }
    }
}

void EulerFunc(){
    for (int64_t i = l; i <= r; i++)
        Euler[i - l] = i, num[i - l] = i;
    for (auto x: prime){
        for (int64_t i = l / x * x + bool(l % x) * x; i <= r; i += x)
            if (i >= l){
                Euler[i - l] = Euler[i - l] / x * (x - 1);
                while (num[i - l] % x == 0)
                    num[i - l] /= x;
            }
    }
    for (int64_t i = l; i <= r; i++)
        if (num[i - l] != 1)
            Euler[i - l] = Euler[i - l] / num[i - l] * (num[i - l] - 1);
}

signed main()
{
    cin >> l >> r;
    EulerSieve();
    EulerFunc();
    for (int64_t i = l; i <= r; i++)
        ans += i - Euler[i - l], ans %= 666623333;
    cout << ans << endl;
    return 0;
}